<?php

include('config.php');
include('cache.php');

$test_content = array('缓存测试', 'test', 1);	//测试数据
$cache_content = readcache('test_cache_key', 'other', false);	//读取缓存
if($cache_content == -1 || empty($cache_content)) 
{	//读取失败打印源数据，并更新缓存
	cache_flush('other');
	writecache('test_cache_key', $test_content, 900, 'other', false);
	echo "print from source :\n";
	print_r($test_content);
} 
else 
{	//读取成功，打印缓存数据
	echo "print from cache :\n";
	print_r($cache_content);
}


//关闭数据库连接
mysql_close($db);

?>